package com.ssy.lingxi.platform.manage.controller;

import com.ssy.lingxi.common.response.Wrapper;
import com.ssy.lingxi.platform.manage.api.model.dto.rule.RuleConfigurationDTO;
import com.ssy.lingxi.platform.manage.api.model.dto.rule.RuleConfigurationListDTO;
import com.ssy.lingxi.platform.manage.api.model.vo.rule.RuleConfigurationVO;
import com.ssy.lingxi.platform.manage.service.RuleConfigurationService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.List;

/**
 * @author wrc
 * @menu 平台规则配置 - 规则配置
 * @date 2020/7/20
 */
@RestController
@RequestMapping("/manage")
public class RuleConfigurationController {

    @Resource
    private RuleConfigurationService ruleConfigurationService;

    /**
     * 规则配置列表查询
     */
    @RequestMapping(value = "/rule/configuration/list", method = RequestMethod.GET)
    public Wrapper<List<RuleConfigurationVO>> ruleConfigurationList(@Valid RuleConfigurationListDTO request) {
        return ruleConfigurationService.ruleConfigurationList(request);
    }

    /**
     * 规则配置修改
     */
    @RequestMapping(value = "/rule/configuration/update", method = RequestMethod.POST)
    Wrapper<Void> ruleConfigurationUpdate(@RequestBody RuleConfigurationDTO request) {
        return ruleConfigurationService.ruleConfigurationUpdate(request);
    }
}
